package org.cloudnote.controller;

import org.cloudnote.service.UserService;
import org.cloudnote.util.NoteResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/regist.do")
    @ResponseBody
    public NoteResult userRegist(String name,String password,String nick){

        NoteResult result = userService.regist(name, password,nick);
        System.out.println("result = " + result);
        return result;
    }

    @RequestMapping("/login.do")
    @ResponseBody
    public NoteResult userLogin(String username,String password){
        //System.out.println(username);
        //System.out.println(password);
        NoteResult result = userService.checkLogin(username, password);
       // System.out.println("result = " + result);
        return result;
    }

}